<%@ page language="java" contentType="text/html; charset=UTF-8"
    pageEncoding="UTF-8"%>
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
	<head>
		<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
		<title>Insert title here</title>
		
		<!-- 引入共同的头文件 -->
		<jsp:include page="/common/head.jsp"></jsp:include>
		
	</head>
	<body>
		<div id="dd" class="easyui-dialog" title="My Dialog" style="width:400px;height:200px;"   
        	data-options="iconCls:'icon-ok',resizable:true,modal:true">  
	        	手机：<input name="phone" value="13926583118" class="easyui-numberbox" data-options="iconCls:'icon-man'" style="width:200px"> <br/>
	        	
	        	<br /><br />
	        	密码：<input type="password" name="password" value="123456" class="easyui-textbox" data-options="iconCls:'icon-lock'" style="width:200px"> <br/><br/>
	        	<a id="btn" href="#"  class="easyui-linkbutton" data-options="iconCls:'icon-add'">登录</a> 
		</div>  
		
		
		<script type="text/javascript">
				$(function(){
					$('#btn').click(function(){
						
					var phone =$('input[name=phone]').val();	
					var password =$('input[name=password]').val();	
						
					//登录开始
					$.ajax({
						type:'post',
						data:{
							'phone':phone,
							'password':password,
						},
						url:'${pageContext.request.contextPath}/employee/login',
						dataType:'json',
						success:function(jsonData){
							//alert(jsonData);
							//var jsonData = eval('('+data+')');
					    	var msg = jsonData.message;
					    	var flag = msg.flag;
					    	var message = msg.message;
					        console.log(flag+":"+message);  
					        
					        $.messager.show({
			    				title:'提示',
			    				msg:message,
			    				timeout:1000,
			    				showType:'slide'
			    			});
					        
					        if(1==flag){
					        	setTimeout("window.location.href='${pageContext.request.contextPath}/index.jsp'",1000);
					        	//window.location.href='${pageContext.request.contextPath}/index.jsp';
					        }else{
					        	//window.location.href='${pageContext.request.contextPath}/error.jsp';
					        }
						}
					})
			});
			
				
				
				//登录结束
				
			});
		
		</script>
	
	</body>
</html>